<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <h2>{{name}}</h2>
</div>
<!--<script src="vue.js"></script>-->
<script src="./mvvm-master/js/compile.js"></script>
<script src="./mvvm-master/js/observer.js"></script>
<script src="./mvvm-master/js/watcher.js"></script>
<script src="./mvvm-master/js/mvvm.js"></script>
<script>
    //数据代理 不仅仅是vue中所独有概念(表现) 其他框架中也都会有这样的操作
    //方便操作data
    //MVVM ==> Vue
    const vm = new MVVM({
        el: "#app",
        data: {
            name: "你好世界"
        }
    });

    console.log(vm.name,vm);//你好世界  vm代理对data数据读操作
    vm.name = "hello world";//vm代理对data数据写操作
    console.log(vm._data.name,vm.name)


    /*let obj = {
        data:{
            name:"123",
            age: 18
        },
        // name:(...)
    }

    Object.defineProperty(obj, "name", {
        get() {
            return obj.data.name
        },
        set(v) {
            obj.data.name = v
        }
    })

    // obj.name = 456*/

</script>
</body>
</html>